﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WLDAL
{
    /// <summary>
    /// 为3D彩票数据管理提供数据
    /// </summary>
    public class DALDataManagement3D
    {
        #region 属性
        /// <summary>
        /// 数据库连接实例
        /// </summary>
        private ProjectTools.SqlHelper sqlHelper = new ProjectTools.SqlHelper(System.Configuration.ConfigurationManager.AppSettings["SqlConnectionString"]);
        /// <summary>
        /// 存储过程参数
        /// </summary>
        private Dictionary<String, Object> dicParam = new Dictionary<string, object>();
        #endregion

        #region 方法
        /// <summary>
        /// 添加3D福彩记录
        /// </summary>
        /// <param name="entityLottery3D">福彩记录实体</param>
        /// <returns>执行结果，成功返回true，失败返回false</returns>
        public bool AddLotteryData(WLEntity.Lottery3D entityLottery3D)
        {
            bool result = false;
            string msg = "";
            dicParam.Clear();  //清空字典
            try
            {
                //字典赋值
                dicParam.Add("@LotteryPeriods", entityLottery3D.LotteryPeriods);
                dicParam.Add("@HundredNum", entityLottery3D.HundredNum);
                dicParam.Add("@TenNum", entityLottery3D.TenNum);
                dicParam.Add("@BitsNum", entityLottery3D.BitsNum);
                dicParam.Add("@msg", msg);
                //执行存储过程
                sqlHelper.ExecProcedure("Proc_AddT3DLotteryRecord", ref dicParam);
                msg = dicParam["@msg"].ToString();
                if (msg == "执行成功")
                {
                    result = true;
                }
                else
                {
                    result = false;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return result;
        }
        #endregion

    }
}
